﻿@{
    Layout = null;
}
@model System.Data.DataTable
<!DOCTYPE html>
<html>
<head>
    <title>税款查询</title>
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>
    @Html.DevExpress().GetStyleSheets(
                new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme },
                new StyleSheet { ExtensionType = ExtensionType.DropDownEdit, Theme = DevExpressHelper.Theme },
                new StyleSheet { ExtensionType = ExtensionType.ComboBox, Theme = DevExpressHelper.Theme }
)
    <script src="@Url.Content("~/Scripts/checkinput.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    <style>
        #form_query
        {
        }
        input
        {
            border: 1px solid #aecaf0;
        }
        input.txt
        {
            width: 99%;
        }
        input.btn
        {
            padding: 3px 10px 2px;
            border: #a3c0e8 1px solid;
            background: #e2f0ff url(/EnterpriseFund/DXR.axd?r=0_54) repeat-x 50% top;
            color: #2c4d79;
            cursor: pointer;
        }
        input.btn:hover
        {
            background-image: url(/EnterpriseFund/DXR.axd?r=0_57);
        }
        th
        {
            text-align: right;
        }
    </style>
    <script type="text/javascript">
//<![CDATA[
        var textSeparator = ";";
        function OnListBoxSelectionChanged(listBox, args) {
            if (args.index == 0)
                args.isSelected ? listBox.SelectAll() : listBox.UnselectAll();
            UpdateSelectAllItemState();
            UpdateText();
        }
        function UpdateSelectAllItemState() {
            IsAllSelected() ? checkListBox.SelectIndices([0]) : checkListBox.UnselectIndices([0]);
        }
        function IsAllSelected() {
            for (var i = 1; i < checkListBox.GetItemCount(); i++)
                if (!checkListBox.GetItem(i).selected)
                    return false;
            return true;
        }
        function UpdateText() {
            var selectedItems = checkListBox.GetSelectedItems();
            checkComboBox.SetText(GetSelectedItemsText(selectedItems));
        }
        function SynchronizeListBoxValues(dropDown, args) {
            checkListBox.UnselectAll();
            var texts = dropDown.GetText().split(textSeparator);
            var values = GetValuesByTexts(texts);
            checkListBox.SelectValues(values);
            UpdateSelectAllItemState();
            UpdateText(); // for remove non-existing texts
        }
        function GetSelectedItemsText(items) {
            var texts = [];
            for (var i = 0; i < items.length; i++)
                if (items[i].index != 0)
                    texts.push(items[i].text);
            return texts.join(textSeparator);
        }
        function GetValuesByTexts(texts) {
            var actualValues = [];
            var item;
            for (var i = 0; i < texts.length; i++) {
                item = checkListBox.FindItemByText(texts[i]);
                if (item != null)
                    actualValues.push(item.value);
            }
            return actualValues;
        }
// ]]> 
    </script>
    <script type="text/javascript">
        var rootUrl = '@Url.Content("~/QueryTax/")';

        function CheckValues() {
            var taxClass = TaxClass.GetValue();
            var yskm = Yskm.GetValue();
            var hydl = Hydl.GetValue();
            var zsfs = Zsfs.GetValue();
            var sksx = Sksx.GetValue();
            var sjly = Sjly.GetValue();
            var nsrsbh = Nsrsbh.GetText();
            var nsrbm = Nsrbm.GetText();
            var nsrmc = Nsrmc.GetText();
            var rKRQBeginDate = "";
            if (RKRQBeginDate.GetDate() != null) {
                rKRQBeginDate = RKRQBeginDate.GetValue();
            }
            var rKRQEndDate = "";
            if (RKRQEndDate.GetDate() != null) {
                rKRQEndDate = RKRQEndDate.GetValue();
            }
            var sSRQBeginDate = "";
            if (SSRQBeginDate.GetDate() != null) {
                sSRQBeginDate = SSRQBeginDate.GetValue();
            }
            var sSRQEndDate = "";
            if (SSRQBeginDate.GetDate() != null) {
                sSRQEndDate = SSRQBeginDate.GetValue();
            }
       var SKSJA=     SKSJA1.GetText()
       var SKSJB = SKSJB1.GetText()
            //无条件查询可能因数据量太大导致系统缓慢及内在淡出溢出错误。
       if (!(taxClass || yskm || hydl || zsfs || sksx || sjly || nsrsbh || nsrbm || nsrmc || rKRQBeginDate || rKRQEndDate || sSRQBeginDate || sSRQEndDate || SKSJA || SKSJB)) {
                alert("请输入查询条件！");
                return false;
            }
            return true;
        }

        function OnBeginCallback(s, e) {
            e.customArgs["command"] = e.command;


            var taxClass = $("#htaxClass").val();
            var yskm = $("#hyskm").val();
            var hydl = $("#hhydl").val();
            var zsfs = $("#hzsfs").val();
            var sksx = $("#hsksx").val();
            var sjly = $("#hsjly").val();
            var nsrsbh = $("#hnsrsbh").val();
            var nsrbm = $("#hnsrbm").val();
            var nsrmc = $("#hnsrmc").val();
            var rKRQBeginDate = $("#hrKRQBeginDate").val();
            var rKRQEndDate = $("#hrKRQEndDate").val();
            var sSRQBeginDate = $("#hsSRQBeginDate").val();
            var sSRQEndDate = $("#hsSRQEndDate").val();
            var isReject = $("#hisReject").val();
            var SKSJA = $("#hSKSJA").val();
            var SKSJB = $("#hSKSJB").val();
            if (SKSJA != null && SKSJA != "") {
                //  e.customArgs["SKSJA"] = parseInt(SKSJA) * 10000;
                e.customArgs["SKSJA"] = SKSJA;
            }
            if (SKSJB != null && SKSJB != "") {
                //  e.customArgs["SKSJB"] = parseInt(SKSJB) * 10000;
                e.customArgs["SKSJB"] = SKSJB;
            }
            //             var taxClass = TaxClass.GetValue();
            //            var yskm = Yskm.GetValue();
            //            var hydl = Hydl.GetValue();
            //            var zsfs = Zsfs.GetValue();
            //            var sksx = Sksx.GetValue();
            //            var sjly = Sjly.GetValue();
            //            var nsrsbh = Nsrsbh.GetText();
            //            var nsrbm = Nsrbm.GetText();
            //            var nsrmc = Nsrmc.GetText();
            //            var rKRQBeginDate = RKRQBeginDate.GetValue();
            //            var rKRQEndDate = RKRQEndDate.GetValue();
            //            var sSRQBeginDate = SSRQBeginDate.GetValue();
            //            var sSRQEndDate = SSRQEndDate.GetValue();
            //            var isReject = IsReject.GetValue() ? "C" : "U";

            e.customArgs["taxClass"] = taxClass;
            e.customArgs["yskm"] = yskm;
            e.customArgs["hydl"] = hydl;
            e.customArgs["zsfs"] = zsfs;
            e.customArgs["sksx"] = sksx;
            e.customArgs["sjly"] = sjly;
            e.customArgs["nsrsbh"] = nsrsbh;
            e.customArgs["nsrbm"] = nsrbm;
            e.customArgs["nsrmc"] = nsrmc;
            e.customArgs["RKRQBeginDate"] = rKRQBeginDate;
            e.customArgs["RKRQEndDate"] = rKRQEndDate;
            e.customArgs["SSRQBeginDate"] = sSRQBeginDate;
            e.customArgs["SSRQEndDate"] = sSRQEndDate;
            e.customArgs["isReject"] = isReject;
        }


        //查询
        function search() {
            //            if (CheckValues()) {
            //                form_query.action = rootUrl;
            //                form_query.submit();
            //            }
            if (CheckValues()) {
                $("#htaxClass").val(TaxClass.GetValue());
                $("#hyskm").val(Yskm.GetValue());
                $("#hhydl").val(Hydl.GetValue());
                $("#hzsfs").val(Zsfs.GetValue());
                $("#hsksx").val(Sksx.GetValue());
                $("#hsjly").val(Sjly.GetValue());
                $("#hnsrsbh").val(Nsrsbh.GetText());
                $("#hnsrbm").val(Nsrbm.GetText());

                $("#hnsrmc").val(Nsrmc.GetText());
                if (RKRQBeginDate.GetDate() != null) {
                    $("#hrKRQBeginDate").val(RKRQBeginDate.GetText());
                }
                if (RKRQEndDate.GetDate() != null) {
                    $("#hrKRQEndDate").val(RKRQEndDate.GetText());
                }
                if (SSRQBeginDate.GetDate() != null) {
                    $("#hsSRQBeginDate").val(SSRQBeginDate.GetText());
                }
                if (SSRQEndDate.GetDate() != null) {
                    $("#hsSRQEndDate").val(SSRQEndDate.GetText());
                }

                $("#hisReject").val(IsReject.GetValue() ? "C" : "U");
                $("#hSKSJA").val(SKSJA1.GetText());
                $("#hSKSJB").val(SKSJB1.GetText());
                $("#hsearched").val("T");
                gvEditing.Refresh();
            }
        }
        function Changed() {
        }
        function Changedold() {
            $.ajax({
                type: 'POST',
                url: rootUrl + 'GetYskms',
                data: { TaxClass: ASPxClientComboBox.Cast("TaxClass").GetValue() },
                success: function (result) {
                    ASPxClientComboBox.Cast("Yskm").ClearItems()
                    var List = JSON.parse(result);
                    for (var i = 0; i < List.length; i++) {
                        ASPxClientComboBox.Cast("Yskm").AddItem(List[i].YSKM_MC, List[i].YSKM_DM, "");
                        //                        alert(List[i].yskm_mc);
                        //                        alert(List[i].yskm_dm);
                    }
                }
            });
        }

        //重置
        function undo() {
            TaxClass.SetValue("");
            Yskm.SetValue("");
            Hydl.SetValue("");
            Zsfs.SetValue("");
            Sksx.SetValue("");
            Sjly.SetValue("");
            RKRQBeginDate.SetText("");
            RKRQEndDate.SetText("");

            SSRQBeginDate.SetText("");

            SSRQEndDate.SetText("");
           
           
        }

        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnExcel":
                    {
                        if ($("#hsearched").val() == "T") {
                            //if (CheckValues())
                            form_query.target = '_self';
                            form_query.action = rootPath + "/QueryTax/ExportToXls";
                            form_query.submit();
                        }
                        break;


                    }
                case "btnReport":
                    {
                        if ($("#hsearched").val() == "T") {
                            window.showModalDialog(rootPath + "/QueryTax/Print", window, "dialogWidth=800px;dialogHeight=500px");
                        }
                        //if (CheckValues())
                        //                        form_query.target = '_blank';
                        //                        //  form_query.target = 'parent.contentframe';
                        //                        //  parent.contentframe.url(
                        //                        //  form_query.action = rootPath + "/QueryTax/Print";
                        //                        form_query.action = '@Url.Content("~/QueryTax/Print")';
                        //                        form_query.submit();
                        break;


                    }

                case "btnGridShow":
                    {
                        gvEditing.ShowCustomizationWindow();
                        break;
                    }
            }
        }
        function keyPress() {
            if (event.keyCode && event.keyCode == 13) {
                search();

            }

        }
    </script>
</head>
<body  onkeypress="keyPress()">
    @Html.Partial("LoadPanelPartial")
    @Html.DevExpress().Menu(settings =>
{
    settings.Name = "toolBarMenu";
    settings.ItemAutoWidth = false;
    settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
    settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
    settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);
    settings.Items.Add(item =>
    {
        item.Name = "btnExcel";
        item.Text = "导出Excel";
        item.Image.Url = Url.Content("~/Content/ControlImages/excel.png");
    });
    settings.Items.Add(item =>
    {
        item.Name = "btnReport";
        item.Text = "打印";
        item.Image.Url = Url.Content("~/Content/icons/print.png");
    });


    settings.Items.Add(item =>
    {
        item.Name = "btnGridShow";
        item.Text = "选择列";
        item.Image.Url = Url.Content("~/Content/FunctionImages/AllowanceFileAudit.png");
    });
	
    settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
    settings.ItemLinkMode = ItemLinkMode.ContentBounds;
}).GetHtml()
    <form name="form_query" id="form_query" method="post" class="form_query" action="@Url.Content("~/QueryTax/index")">
    <table class="query" width="800px" style="margin-left: auto; margin-right: auto">
        <tr>
            <td align="right" style="text-align: right">
                纳税人识别号：
            </td>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "Nsrsbh";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(110);
               }).GetHtml()
            </td>
            <td align="right" style="text-align: right">
                税种：
            </td>
            <td>@Html.DevExpress().ComboBox(settings =>
           {
               settings.Name = "TaxClass";
               settings.Width = System.Web.UI.WebControls.Unit.Pixel(100);
               settings.Properties.TextField = "FTaxClassShortName";
               settings.Properties.ValueField = "FTaxClassNo";
               settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
               settings.Properties.DropDownStyle = DropDownStyle.DropDown;
               settings.Properties.ClientSideEvents.SelectedIndexChanged = "Changed";

           }).BindList(ViewBag.TaxClasses).Bind(ViewBag.TaxClass).GetHtml()
            </td>
            <td align="right" style="text-align: right">
                行业类别：
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            @Html.DevExpress().ComboBox(settings =>
      {
          settings.Name = "Hydl";
          settings.Width = System.Web.UI.WebControls.Unit.Pixel(192);
          settings.Properties.TextField = "HYDL_MC";
          settings.Properties.ValueField = "HYDL_DM";
          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
          settings.Properties.DropDownStyle = DropDownStyle.DropDown;
          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
          settings.Properties.DropDownStyle = DropDownStyle.DropDown;
      }).BindList(ViewBag.Hydls).Bind(ViewBag.Hydl).GetHtml()
                        </td>
                    </tr>
                </table>
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            @Html.DevExpress().Button(settings =>
      {
          settings.Name = "btnSearch";
          settings.Text = "查询";
          settings.ControlStyle.CssClass = "button";
          settings.Images.Image.Url = Url.Content("~/Content/ControlImages/search.png");
          settings.ClientSideEvents.Click = "search";
      }).GetHtml()
                        </td>
                        <td>
                            @Html.DevExpress().Button(settings =>
        {
            settings.Name = "btnUndo";
            settings.Text = "重置";
            settings.ControlStyle.CssClass = "button";
            settings.Images.Image.Url = Url.Content("~/Content/ControlImages/undo_blue.png");
            settings.ClientSideEvents.Click = "undo";
        }).GetHtml()
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="right" style="text-align: right">
                纳税人编码：
            </td>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "Nsrbm";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(110);
               }).GetHtml()
            </td>
            <td align="right" style="text-align: right">
                预算科目：
            </td>
            <td>@Html.DevExpress().ComboBox(settings =>
           {
               settings.Name = "Yskm";
               settings.Width = System.Web.UI.WebControls.Unit.Pixel(100);
               settings.Properties.TextField = "yskm_mc";
               settings.Properties.ValueField = "yskm_dm";
               settings.Properties.EnableClientSideAPI = true;
           }).BindList(ViewBag.Yskms).Bind(ViewBag.Yskm).GetHtml()
            </td>
            <td>
                所属日期：
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            @Html.DevExpress().DateEdit(settings =>
           {
               settings.Name = "SSRQBeginDate";
               settings.Width = 90;
               settings.Properties.ShowShadow = true;
               settings.Properties.EditFormat = EditFormat.Date;
               settings.Properties.EditFormatString = "yyyy-MM-dd";
               settings.Properties.MinDate = DateTime.Parse("1900-01-01");
               settings.Properties.UseMaskBehavior = true;
           }).Bind(ViewBag.SSRQBeginDate).GetHtml()
                        </td>
                        <td>
                            -
                        </td>
                        <td>
                            @Html.DevExpress().DateEdit(settings =>
                          {
                              settings.Name = "SSRQEndDate";
                              settings.Width = 90;
                              settings.Properties.ShowShadow = true;
                              settings.Properties.EditFormat = EditFormat.Date;
                              settings.Properties.EditFormatString = "yyyy-MM-dd";
                              settings.Properties.MinDate = DateTime.Parse("1900-01-01");
                              settings.Properties.UseMaskBehavior = true;
                          }).Bind(ViewBag.SSRQEndDate).GetHtml()
                        </td>
                    </tr>
                </table>
            </td>
            
            <td colspan="2">
                @Html.DevExpress().CheckBox(settings =>
            {
                settings.Text = "已剔除数据";
                settings.Name = "IsReject";
                //settings.Checked = ViewBag.IsReject;
            }).GetHtml()
            </td>
        </tr>
        <tr>
            <td align="right" style="text-align: right">
                纳税人名称：
            </td>
            <td>
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "Nsrmc";
                   settings.Width = System.Web.UI.WebControls.Unit.Pixel(110);
               }).GetHtml()
            </td>
            <td align="right" style="text-align: right">
                征收方式：
            </td>
            <td>@Html.DevExpress().ComboBox(settings =>
           {
               settings.Name = "Zsfs";
               settings.Width = System.Web.UI.WebControls.Unit.Pixel(100);
               settings.Properties.TextField = "zsfs_mc";
               settings.Properties.ValueField = "zsfs_dm";
               settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
               settings.Properties.DropDownStyle = DropDownStyle.DropDown;
           }).BindList(ViewBag.Zsfses).Bind(ViewBag.Zsfs).GetHtml()
            </td>
            <td>
                入库日期：
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            @Html.DevExpress().DateEdit(settings =>
           {
               settings.Name = "RKRQBeginDate";
               settings.Width = 90;
               settings.Properties.ShowShadow = true;
               settings.Properties.EditFormat = EditFormat.Date;
               settings.Properties.EditFormatString = "yyyy-MM-dd";
               settings.Properties.MinDate = DateTime.Parse("1900-01-01");
               settings.Properties.UseMaskBehavior = true;
           }).Bind(ViewBag.RKRQBeginDate).GetHtml()
                        </td>
                        <td>
                            -
                        </td>
                        <td>
                            @Html.DevExpress().DateEdit(settings =>
                          {
                              settings.Name = "RKRQEndDate";
                              settings.Width = 90;
                              settings.Properties.ShowShadow = true;
                              settings.Properties.EditFormat = EditFormat.Date;
                              settings.Properties.EditFormatString = "yyyy-MM-dd";
                              settings.Properties.MinDate = DateTime.Parse("1900-01-01");
                              settings.Properties.UseMaskBehavior = true;
                          }).Bind(ViewBag.RKRQEndDate).GetHtml()
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="right" style="text-align: right">
                税款属性：
            </td>
            <td>@Html.DevExpress().ComboBox(settings =>
           {
               settings.Name = "Sksx";
               settings.Width = System.Web.UI.WebControls.Unit.Pixel(110);
               settings.Properties.TextField = "sksx_mc";
               settings.Properties.ValueField = "sksx_dm";
               settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
               settings.Properties.DropDownStyle = DropDownStyle.DropDown;
           }).BindList(ViewBag.Sksxes).Bind(ViewBag.Sksx).GetHtml()
            </td>
            <td align="right" style="text-align: right">
                数据来源：
            </td>
            <td>@Html.DevExpress().ComboBox(settings =>
           {
               settings.Name = "Sjly";

               settings.Width = System.Web.UI.WebControls.Unit.Pixel(100);
               settings.Properties.Items.Add("", "");
               settings.Properties.Items.Add("国税", "1");
               settings.Properties.Items.Add("地税", "2");
           }).Bind(ViewBag.Sjly).GetHtml()
            </td>
            <td  align="right" style="text-align:right">
                    税款数据：
                    </td>
                <td >
                <table>
                <tr>
                <td>
                 @Html.DevExpress().TextBox(settings =>
            {
                settings.Name = "SKSJA1";
                settings.Width = System.Web.UI.WebControls.Unit.Pixel(90);
            }).Bind(ViewBag.SKSJA).GetHtml()
                </td>
                    <td> - </td>
                    <td>
                               @Html.DevExpress().TextBox(settings =>
                          {
                              settings.Name = "SKSJB1";
                              settings.Width = System.Web.UI.WebControls.Unit.Pixel(90);
                          }).Bind(ViewBag.SKSJB).GetHtml()
                </td>
                </tr>
                </table>
               </td>   
        </tr>
    </table>
    @Html.Partial("QueryTaxPartial", Model)
    @Html.Hidden("htaxClass", "")
    @Html.Hidden("hyskm", "")
    @Html.Hidden("hhydl", "")
    @Html.Hidden("hzsfs", "")
    @Html.Hidden("hsksx", "")
    @Html.Hidden("hsjly", "")
    @Html.Hidden("hnsrsbh", "")
    @Html.Hidden("hnsrbm", "")
    @Html.Hidden("hnsrmc", "")
    @Html.Hidden("hrKRQBeginDate", "")
    @Html.Hidden("hrKRQEndDate", "")
    @Html.Hidden("hsSRQBeginDate", "")
    @Html.Hidden("hsSRQEndDate", "")
    @Html.Hidden("hisReject", "")
     @Html.Hidden("hSKSJA","")
         @Html.Hidden("hSKSJB","")
         @Html.Hidden("hsearched","F")
    </form>
</body>
</html>
<script>
    lp.Hide();
</script>
